<?php

declare(strict_types=1);
/**
 * Author: Zane
 * Email: 873934580@qq.com
 * Date: 2023/5/25.
 */

namespace App\Models;

/**
 * @property int id
 * @property int system_id
 * @property int login_at
 * @property int login_ip
 * @property int status
 */
class SystemLog extends BaseModel
{
    public function getLoginAtAttribute()
    {
        return date('Y-m-d H:i:s', $this->attributes['login_at']);
    }

    public function getLoginIpAttribute(): string
    {
        return long2ip($this->attributes['login_ip']);
    }

    public function system(): \Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(System::class, 'system_id', 'id');
    }
}
